<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <div id="late_coach_totaltb">
        <form id="late_coach_totalForm" class="m5">
            时间：
            <input class="easyui-datebox form-control1" name="startDate" id="startDate"> - <input class="easyui-datebox form-control1" name="endDate" id="endDate">
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="searchForm('late_coach_total')">查询</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm('late_coach_total')">重置</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-save'" onclick="outExcel('late_coach_total','/lateCoach/late_coach_total')">导出为EXCEL</a>
        </form>
    </div>
    <table id="late_coach_totaldg">
        <thead>
            <tr>
                <th data-options="field:'grade'">年级</th>
                <th data-options="field:'teacherName'">教师姓名</th>
                <th data-options="field:'classTeacher'">是否班主任</th>
                <th data-options="field:'d1Count'">周一(次)</th>
                <th data-options="field:'d2Count'">周二(次)</th>
                <th data-options="field:'d3Count'">周三(次)</th>
                <th data-options="field:'d4Count'">周四(次)</th>
                <th data-options="field:'d8Count'">第八节(次)</th>
                <th data-options="field:'totalCount'">总数(次)</th>
            </tr>
        </thead>
    </table>
    <script type="text/javascript">
        $(function(){
            $("#startDate").datebox('setValue', getTime(getCurrentMonthFirst(),'yyyy-MM-dd'));
            $("#endDate").datebox('setValue',getTime(getCurrentMonthLast(),'yyyy-MM-dd'));
            var url = "/lateCoach/late_coach_total";
            initDategrids("late_coach_total", url);
        })
        function initDategrids(cf,url) {
            $("#"+cf+"dg").datagrid({
                url: url + "/pageQuery.html",
                rownumbers: true,
                striped: true,
                border: false,
                pagination: false,
                pageSize: 30,
                fitColumns: true,
                autoRowHeight: false,
                singleSelect: true,
                queryParams : {
                    startDate: $("#startDate").datebox('getValue'),
                    endDate: $("#endDate").datebox('getValue')
                },
                fit: true,
                toolbar: "#"+cf+"tb",
            })
        }
        function getTime(v, format) {
            if(v) return (new Date(v)).Format(format);
            return "";
        }
        function getCurrentMonthFirst(){
            var date=new Date();
            date.setDate(1);
            return date;
        }
        // 获取当前月的最后一天
        function getCurrentMonthLast(){
            var date=new Date();
            var currentMonth=date.getMonth();
            var nextMonth=++currentMonth;
            var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
            var oneDay=1000*60*60*24;
            return new Date(nextMonthFirstDay-oneDay);
        }

        Date.prototype.Format = function(fmt)   
        {    
        var o = {   
         "M+" : this.getMonth()+1,                 //月份    
         "d+" : this.getDate(),                    //日    
         "h+" : this.getHours(),                   //小时    
         "m+" : this.getMinutes(),                 //分    
         "s+" : this.getSeconds(),                 //秒    
         "q+" : Math.floor((this.getMonth()+3)/3), //季度    
         "S"  : this.getMilliseconds()             //毫秒    
        };   
        if(/(y+)/.test(fmt))   
         fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
        for(var k in o)   
         if(new RegExp("("+ k +")").test(fmt))   
        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
        return fmt;   
        } 
    </script>

</body>
</html>